<script setup lang="ts">
import BlockBox from '../BlockBox.vue';
import { ref } from "vue"
import { ESButton, ESColor } from '../../packages/index';
let colorp = ref({
    r: 70,
    g: 70,
    b: 70,
    a: 0.3
})
function getRandomNum_ab(min: number, max: number) {
    const num = Math.random() * (max - min - 1) + (min + 1);
    const randomNum = Math.floor(num);
    return randomNum;
}
const randomColor = () => {
    colorp.value = {
        r: getRandomNum_ab(0, 255),
        g: getRandomNum_ab(0, 255),
        b: getRandomNum_ab(0, 255),
        a: 0.3
    }
}
</script>

<template>
    <BlockBox text="颜色选择">
        <ESButton @click="randomColor">随机颜色</ESButton>
        <div style="width: 310px; margin-left: 1px;">
            <ESColor :color="colorp">
            </ESColor>
        </div>
    </BlockBox>
</template>
